#include "MoveCommand.h"
#include <GraphicsBaseItem.h>

MoveCommand::MoveCommand(GraphicsBaseItem* item, const QPointF& oldPos, const QPointF& newPos)
	: BaseCommand()
	, m_item(item)
	, m_oldPos(oldPos)
	, m_newPos(newPos)
{

}

MoveCommand::~MoveCommand()
{

}

void MoveCommand::undo()
{
	m_item->setPos(m_oldPos);
}

void MoveCommand::redo()
{
	if (m_isFirstPush) {
		m_isFirstPush = false;
		return;
	}
	m_item->setPos(m_newPos);

}
